<?php !defined( 'SUNCMS' ) && exit( 'No direct script access allowed'  );

/**
 * 
 * Sun CMS
 * 
 * @author			Burning
 * @copyright		Copyright (c) 2009, IsunCms.Com.
 * @license			http://www.isuncms.com/license.htm
 * @link				http://www.isuncms.com/
 * @since				Version 1.0 Beta
 * 
 */

if( $do == 'index' )
{
	$menu = cache_read( 'menu' );
	$top_menu = array();
	$left_menu = array();
	$i = 0;
	foreach( $menu as $k => $v )
	{
		if( $v['show'] && $v['child'] )
		{
			$top_menu[$i]['name'] = $v['name'];
			$j = 0;
			foreach( $v['child'] as $k2 => $v2 )
			{
				if( $v2['show'] )
				{
					if( $j === 0 )
					{
						$url_array = explode( '&', $v2['url'] );
						$action_array = explode( '=', $url_array[1] );
						$top_menu[$i]['url'] = $group_priv[$url_array[0]][$action_array[1]]?$v2['url']:'';
					}
					$left_menu[$i][] = $v2;
					$j++;
				}
			}
			$i++;
		}
	}
	include display( 'iframe' );
}
elseif( $do == 'systeminfo' )
{
	$sql = "SELECT `b`.`name` as `role`, `c`.`last_login_ip`, `c`.`last_login_time`, `c`.`login_times` FROM `".DB_PRE."member` as `a`
			LEFT JOIN `".DB_PRE."membergroup` as `b` ON `a`.`group_id` = `b`.`id` 
			LEFT JOIN `".DB_PRE."memberdata` as `c` ON `c`.`uid` = $user_id 
			WHERE `a`.`id` = $user_id";
	$info = $db->query( $sql, true );
	include display( 'home' );
}